package cn.com.roy.thread.t3_1_11.p_c_allWait;

public class C {
    private String lock;

    public C(String lock) {
        this.lock = lock;
    }

    public void getValue() {
        synchronized (lock) {
            if (ValueObject.value.equals("")) {
                try {
                    System.out.println("消费者："+Thread.currentThread().getName() + " waiting ");
                    lock.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("消费者："+Thread.currentThread().getName() + " running ");

           // System.out.println("get 的值是：" + ValueObject.value);
            ValueObject.value = "";
            lock.notify();
        }
    }

}
